feat(user)!: return total count in search and searchTestUsers responses#664
feat(user)!: return total count in search and searchTestUsers responses#664
Conversation
BREAKING CHANGE: The `search` and `searchTestUsers` methods now return
`UserSearchResponse` with `{ users, total }` instead of `UserResponse[]`.
Before:
const res = await sdk.management.user.search({...});
res.data.forEach(user => ...);
After:
const res = await sdk.management.user.search({...});
console.log(res.data.total);
res.data.users.forEach(user => ...);
Closes #662
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
✅ Code review completed successfully |
There was a problem hiding this comment.
🐕 Shuni's Review
This PR changes search and searchTestUsers to return { users, total } instead of a bare UserResponse[], exposing the total count from the API. Breaking change is clearly documented.
LGTM — no issues found. Good bones! The new UserSearchResponse type is clean, the deprecated searchAll is correctly left untouched for backward compat, tests and docs are updated consistently. Woof!
There was a problem hiding this comment.
Pull request overview
Updates the Management User SDK APIs to match the backend search response shape by returning both the matched users and the total count, addressing issue #662 and introducing a breaking response-type change for search and searchTestUsers.
Changes:
- Change
management.user.searchandmanagement.user.searchTestUsersto return{ users, total }instead ofUserResponse[]. - Add
UserSearchResponsetype and update user management tests to validate the new response shape. - Update README usage examples to reflect the new response structure.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/management/user.ts | Changes search/searchTestUsers return types and response transformation to include total. |
| lib/management/user.test.ts | Updates mocks and assertions to validate { users, total } responses. |
| lib/management/types.ts | Introduces exported UserSearchResponse type. |
| README.md | Updates examples to use data.total and data.users. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
BREAKING CHANGE: The
searchandsearchTestUsersmethods now returnUserSearchResponsewith{ users, total }instead ofUserResponse[].Before:
After:
Fixes #662
Must